package com.wind.cloud.common.config.rest;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Primary;
import org.springframework.web.client.RestTemplate;

/**
 * RestTemplate配置类
 *
 * @author wind.
 */
@Configuration
public class RestTemplateConfig {

    @Primary
    @Bean
    public RestTemplate defaultRestTemplate() {
        RestTemplate restTemplate = new RestTemplate(RestTemplateUtils.messageConverters());
        restTemplate.setRequestFactory(RestTemplateUtils.clientHttpRequestFactory());
        restTemplate.getInterceptors().add(new LoggingClientHttpRequestInterceptor());
        return restTemplate;
    }

}